home *** CD-ROM | disk | FTP | other *** search
- ATARI MACHINE SPECIFIC LIBRARY
-
-
-
- NAME
- Oscillator - cyclic value objects
-
- SYNOPSIS
- #include <Oscillator.h>
-
- class Oscillator
- class Cycle
-
- DESCRIPTION
- Many games contain elements (graphical or otherwise) that cycle
- or oscillate at a regular rate. This module provides simple
- classes for such objects.
-
- CLASSES
- class Oscillator embodies the concept of a value that goes up then
- down cyclically.
-
- class Cycle embodies the concept of a value that pulses after at
- a certain rate.
-
- CLASS MEMBERS
- Oscillator::
- Oscillator(int min,int max)
- A value that cycles to and from min and max. Initially from min.
-
- operator int()
- The value.
-
- int Oscillate()
- Advance oscillation.
-
- Cycle::
- Cycle()
- A value that pulses every second access to operator()().
-
- Cycle(int n)
- A value that pulses every n accesses to operator()().
-
- bool operator()()
- Advances cycle and returns TRUE iff at the top of the cycle.
-
- void Rate(int R)
- Change the rate of the cycle.
-
- EXAMPLES
- Oscillator Bounce(0,10);
-
- while (...) {
- s.MoveTo(x,Bounce);
- Bounce.Oscillate();
- }
-
- Cycle Pulse(4);
-
- while (...) {
- if (Pulse) {
- // Do every 4 times through loop
- }
- }
-
- AUTHOR
- Warwick Allison, 1992.
- warwick@cs.uq.oz.au
-
- COPYING
- This functionality is part of the Atari Machine Specific Library,
- and is Copyright 1992 by Warwick W. Allison.
-
- The Atari Machine Specific Library is free and protected under the
- GNU Library General Public License.
-
- You are free to copy and modify these sources, provided you acknowledge
- the origin by retaining this notice, and adhere to the conditions
- described in the GNU LGPL.
-